Full source code website bán hàng thương mại điện tử gần giống shopee
468.832 lượt xem;
1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2 <tr align=center>
3 <td class="title" width="100%">Tư vấn : <a href="./?act=faq_m&page=<? echo $_REQUEST['page']?>&cat=<? echo $_REQUEST['cat']; ?>"><font class="V10pt" color="#ffffff">Nhập Mới</font></a>
4 </td>
5 </tr>
6 </table>
7 <?
8 switch ($_GET['action'])
9 {
10 case 'del' :
11 $id = $_GET['id'];
12 $result = mysql_query("delete from faq where faq_id='".$id."'",$con);
13 if ($result)
14 echo "<p align=center class='err'>Đã xóa thành công</p>";
15 else
16 echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
17 break;
18 }
19 ?>
20
21 <?
22 if (isset($_POST['ButDel'])) {
23 $cnt=0;
24 foreach ($_POST['chk'] as $id)
25 {
26 @$result = mysql_query("delete from faq where faq_id='".$id."'",$con);
27 if ($result) $cnt++;
28 }
29 echo "<p align=center class='err'>Đã xóa ".$cnt."</p>";
30 }
31 ?>
32
33 <?
34 $page = $_GET["page"];
35 $p=0;
36 if ($page!='') $p=$page;
37 $where="1=1";
38 if ($_REQUEST['status']!='') $where="faq_status=".$_REQUEST['status']." ";
39 if ($_REQUEST['cat']!='') $where.=" and faq_categoriesid=".$_REQUEST['cat'];
40 ?>
41 <form method="POST" name="frmList" action="index.php">
42 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
43 <?
44 function taotrang($sql,$link,$nitem,$itemcurrent)
45 { global $con;
46 $ret="";
47 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
48 $value = mysql_fetch_array($result);
49 $plus = (($value['cnt'] % $nitem)>0);
50 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
51 {
52 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
53 else $ret .= ($i+1)." ";
54 }
55 return $ret;
56 }
57 $pageindex=taotrang("select count(*) from faq where $where","./?act=".$_REQUEST['act']."&status=".$_REQUEST['status']."&cat=".$_REQUEST['cat']."&sortby=".$_REQUEST['sortby']."&direction=".$_REQUEST['direction']."&page=",$MAXPAGE,$page);
58 ?>
59
60 <table cellspacing="0" cellpadding="0" width="100%">
61 <? if ($_REQUEST['code']==1) echo '<tr><td colspan=2 align="center" class="err">Đã cập nhật thành công</td></tr>'; ?>
62 <tr>
63 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
64 <td height="30" align="right" class="smallfont">
65 <select size="1" name="ddCat" class="smallfont">
66 <?
67 $result = mysql_query("select * from faq_categories",$con);
68 echo '<option value="">[Tất cả]</option>';
69 while(($row=@mysql_fetch_assoc($result)))
70 if ($row['categories_id']!=$_REQUEST['cat'])
71 echo '<option value="'.$row['categories_id'].'">'.$row['categories_name'].'</option>';
72 else
73 echo '<option selected value="'.$row['categories_id'].'">'.$row['categories_name'].'</option>';
74 ?>
75 </select>
76 <input type="button" value="Chuyển" class="button" onclick="window.location='./?act=<? echo $_REQUEST['act']; ?>&status=<? echo $_REQUEST['status']; ?>&cat='+ddCat.value">
77 </td>
78 </tr>
79 </table>
80 <?
81 function GetLinkSort($order)
82 {
83 $direction="";
84 if ($_REQUEST['direction']==''||$_REQUEST['direction']!='0')
85 $direction="0";
86 else
87 $direction="1";
88
89 return "./?act=".$_REQUEST['act']."&cat=".$_REQUEST['cat']."&page=".$_REQUEST['page']."&sortby=".$order."&direction=".$direction;
90 }
91 ?>
92
93 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
94 <tr>
95 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
96 <td colspan="2" nowrap class="title"> </td>
97 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(1); ?>"><b>Mã</b></a></td>
98 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(2); ?>"><b>Tên câu hỏi</b></a></td>
99 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(3); ?>"><b>Họ tên</b></a></td>
100 <td align="center" nowrap class="title"><a class="title" ><b>Giới tính</b></a></td>
101 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(5); ?>"><b>Email</b></a></td>
102 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(6); ?>"><b>Không hiện</b></a></td>
103 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(7); ?>"><b>Thứ tự</b></a></td>
104 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(8); ?>"><b>Ngày</b></a></td>
105 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(9); ?>"><b>Danh mục</b></a></td>
106 </tr>
107
108 <?
109 $sortby="order by 1";
110 if ($_REQUEST['sortby']!='') $sortby="order by ".(int)$_REQUEST['sortby'];
111 $direction=($_REQUEST['direction']==''||$_REQUEST['direction']=='0'?"desc":"");
112 $sql="select * from faq where $where $sortby $direction limit ".($p*$MAXPAGE).",".$MAXPAGE;
113 $result=mysql_query($sql,$con);
114 $i=0;
115 while(($row=mysql_fetch_array($result)))
116 {
117 $i++;
118 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
119 ?>
120
121 <tr>
122 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
123 <input type="checkbox" name="chk[]" value="<? echo $row['faq_id']; ?>"></td>
124 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
125 <a href="./?act=faq_m&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['faq_id']; ?>&page=<? echo $_REQUEST['page'];?>">Sửa</a></td>
126 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
127 <a onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" href="./?act=<? echo $_REQUEST['act']; ?>&status=<? echo $_REQUEST['status']; ?>&action=del&cat=<? echo $_REQUEST['cat']; ?>&id=<? echo $row['faq_id']; ?>">Xóa</a></td>
128 <td bgcolor="<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['faq_id']; ?> </td>
129 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_nameqa']; ?> </td>
130 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_name']; ?> </td>
131 <td bgcolor="<? echo $color; ?>" class="smallfont"><? if($row['faq_gioitinh']==0){ echo "Nữ";} else { echo "Nam";} ?> </td>
132 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_email']; ?> </td>
133 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_status']; ?> </td>
134 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_sortorder']; ?> </td>
135 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo date('d/m/Y',strtotime($row['faq_dateadded'])); ?> </td>
136 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_categoriesid']; ?> </td>
137 </tr>
138 <?
139 }
140 ?>
141 </table>
142 <input type="hidden" name="act" value="<? echo $_REQUEST['act']; ?>"><table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
143 <tr>
144 <td>
145 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button"></td>
146 <td align="right">
147 </td>
148 </tr>
149 </table>
150 </form>
151 <script language="JavaScript">
152 function chkallClick(o) {
153 var form = document.frmList;
154 for (var i = 0; i < form.elements.length; i++) {
155 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
156 form.elements[i].checked = document.frmList.chkall.checked;
157 }
158 }
159 }
160 </script>
2 <tr align=center>
3 <td class="title" width="100%">Tư vấn : <a href="./?act=faq_m&page=<? echo $_REQUEST['page']?>&cat=<? echo $_REQUEST['cat']; ?>"><font class="V10pt" color="#ffffff">Nhập Mới</font></a>
4 </td>
5 </tr>
6 </table>
7 <?
8 switch ($_GET['action'])
9 {
10 case 'del' :
11 $id = $_GET['id'];
12 $result = mysql_query("delete from faq where faq_id='".$id."'",$con);
13 if ($result)
14 echo "<p align=center class='err'>Đã xóa thành công</p>";
15 else
16 echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
17 break;
18 }
19 ?>
20
21 <?
22 if (isset($_POST['ButDel'])) {
23 $cnt=0;
24 foreach ($_POST['chk'] as $id)
25 {
26 @$result = mysql_query("delete from faq where faq_id='".$id."'",$con);
27 if ($result) $cnt++;
28 }
29 echo "<p align=center class='err'>Đã xóa ".$cnt."</p>";
30 }
31 ?>
32
33 <?
34 $page = $_GET["page"];
35 $p=0;
36 if ($page!='') $p=$page;
37 $where="1=1";
38 if ($_REQUEST['status']!='') $where="faq_status=".$_REQUEST['status']." ";
39 if ($_REQUEST['cat']!='') $where.=" and faq_categoriesid=".$_REQUEST['cat'];
40 ?>
41 <form method="POST" name="frmList" action="index.php">
42 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
43 <?
44 function taotrang($sql,$link,$nitem,$itemcurrent)
45 { global $con;
46 $ret="";
47 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
48 $value = mysql_fetch_array($result);
49 $plus = (($value['cnt'] % $nitem)>0);
50 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
51 {
52 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
53 else $ret .= ($i+1)." ";
54 }
55 return $ret;
56 }
57 $pageindex=taotrang("select count(*) from faq where $where","./?act=".$_REQUEST['act']."&status=".$_REQUEST['status']."&cat=".$_REQUEST['cat']."&sortby=".$_REQUEST['sortby']."&direction=".$_REQUEST['direction']."&page=",$MAXPAGE,$page);
58 ?>
59
60 <table cellspacing="0" cellpadding="0" width="100%">
61 <? if ($_REQUEST['code']==1) echo '<tr><td colspan=2 align="center" class="err">Đã cập nhật thành công</td></tr>'; ?>
62 <tr>
63 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
64 <td height="30" align="right" class="smallfont">
65 <select size="1" name="ddCat" class="smallfont">
66 <?
67 $result = mysql_query("select * from faq_categories",$con);
68 echo '<option value="">[Tất cả]</option>';
69 while(($row=@mysql_fetch_assoc($result)))
70 if ($row['categories_id']!=$_REQUEST['cat'])
71 echo '<option value="'.$row['categories_id'].'">'.$row['categories_name'].'</option>';
72 else
73 echo '<option selected value="'.$row['categories_id'].'">'.$row['categories_name'].'</option>';
74 ?>
75 </select>
76 <input type="button" value="Chuyển" class="button" onclick="window.location='./?act=<? echo $_REQUEST['act']; ?>&status=<? echo $_REQUEST['status']; ?>&cat='+ddCat.value">
77 </td>
78 </tr>
79 </table>
80 <?
81 function GetLinkSort($order)
82 {
83 $direction="";
84 if ($_REQUEST['direction']==''||$_REQUEST['direction']!='0')
85 $direction="0";
86 else
87 $direction="1";
88
89 return "./?act=".$_REQUEST['act']."&cat=".$_REQUEST['cat']."&page=".$_REQUEST['page']."&sortby=".$order."&direction=".$direction;
90 }
91 ?>
92
93 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
94 <tr>
95 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
96 <td colspan="2" nowrap class="title"> </td>
97 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(1); ?>"><b>Mã</b></a></td>
98 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(2); ?>"><b>Tên câu hỏi</b></a></td>
99 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(3); ?>"><b>Họ tên</b></a></td>
100 <td align="center" nowrap class="title"><a class="title" ><b>Giới tính</b></a></td>
101 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(5); ?>"><b>Email</b></a></td>
102 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(6); ?>"><b>Không hiện</b></a></td>
103 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(7); ?>"><b>Thứ tự</b></a></td>
104 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(8); ?>"><b>Ngày</b></a></td>
105 <td align="center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(9); ?>"><b>Danh mục</b></a></td>
106 </tr>
107
108 <?
109 $sortby="order by 1";
110 if ($_REQUEST['sortby']!='') $sortby="order by ".(int)$_REQUEST['sortby'];
111 $direction=($_REQUEST['direction']==''||$_REQUEST['direction']=='0'?"desc":"");
112 $sql="select * from faq where $where $sortby $direction limit ".($p*$MAXPAGE).",".$MAXPAGE;
113 $result=mysql_query($sql,$con);
114 $i=0;
115 while(($row=mysql_fetch_array($result)))
116 {
117 $i++;
118 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
119 ?>
120
121 <tr>
122 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
123 <input type="checkbox" name="chk[]" value="<? echo $row['faq_id']; ?>"></td>
124 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
125 <a href="./?act=faq_m&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['faq_id']; ?>&page=<? echo $_REQUEST['page'];?>">Sửa</a></td>
126 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
127 <a onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" href="./?act=<? echo $_REQUEST['act']; ?>&status=<? echo $_REQUEST['status']; ?>&action=del&cat=<? echo $_REQUEST['cat']; ?>&id=<? echo $row['faq_id']; ?>">Xóa</a></td>
128 <td bgcolor="<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['faq_id']; ?> </td>
129 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_nameqa']; ?> </td>
130 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_name']; ?> </td>
131 <td bgcolor="<? echo $color; ?>" class="smallfont"><? if($row['faq_gioitinh']==0){ echo "Nữ";} else { echo "Nam";} ?> </td>
132 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_email']; ?> </td>
133 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_status']; ?> </td>
134 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_sortorder']; ?> </td>
135 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo date('d/m/Y',strtotime($row['faq_dateadded'])); ?> </td>
136 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['faq_categoriesid']; ?> </td>
137 </tr>
138 <?
139 }
140 ?>
141 </table>
142 <input type="hidden" name="act" value="<? echo $_REQUEST['act']; ?>"><table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
143 <tr>
144 <td>
145 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button"></td>
146 <td align="right">
147 </td>
148 </tr>
149 </table>
150 </form>
151 <script language="JavaScript">
152 function chkallClick(o) {
153 var form = document.frmList;
154 for (var i = 0; i < form.elements.length; i++) {
155 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
156 form.elements[i].checked = document.frmList.chkall.checked;
157 }
158 }
159 }
160 </script>